
#ifndef UTILS_FROM_STRING_HPP
#define	UTILS_FROM_STRING_HPP

#include <boost/lexical_cast.hpp>
#include <Box2D/Box2D.h>
#include "Vector4.h"


template < typename TType >
inline TType from_string( std::string const & string )
{
	return boost::lexical_cast< TType >( string );
}

template <>
inline b2Vec2 from_string< b2Vec2 >( std::string const & string )
{
	b2Vec2 out;
	std::stringstream ss( string );
	ss >> out.x >> out.y;
	return out;
}

template <>
inline Vector4 from_string< Vector4 >( std::string const & string )
{
	Vector4 out;
	std::stringstream ss( string );
	ss >> out.x >> out.y >> out.z >> out.w;
	return out;
}

template <>
inline float from_string< float >( std::string const & string )
{
	float out;
	std::stringstream ss( string );
	ss >> out;
	return out;
}

#endif	//UTILS_FROM_STRING_HPP